package com.example.demo.entryWarehouse.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.demo.common.ResponseData;
import com.example.demo.entryWarehouse.entity.BaseInformation;
import com.example.demo.entryWarehouse.mapper.BaseInformationMapper;
import com.example.demo.entryWarehouse.service.BaseInformationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Wrapper;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wangxuan
 * @since 2021-05-03
 */
@Service
public class BaseInformationServiceImpl extends ServiceImpl<BaseInformationMapper, BaseInformation> implements BaseInformationService {

    @Autowired
    private  BaseInformationMapper baseInformationMapper;

    @Override
    public ResponseData selectAll() {
        List<BaseInformation> baseInformationList = baseInformationMapper.selectList(null);
        return ResponseData.buildOk(baseInformationList);
    }

    @Override
    public ResponseData selectByname(String search) {
        QueryWrapper<BaseInformation> wrapper = new QueryWrapper<>();
        wrapper.like("name",(Object)search);
        List<BaseInformation> baseInformationList = baseInformationMapper.selectList(wrapper);
        return ResponseData.buildOk(baseInformationList);
    }
}
